package biz.obake.team.touchprotector.ui;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import androidx.preference.TwoStatePreference;
import androidx.preference.g;
import biz.obake.team.touchprotector.g.c;

public abstract class a extends g implements SharedPreferences.OnSharedPreferenceChangeListener, c.b {
    private boolean mDeferredReloading = false;

    public void onDestroyView() {
        super.onDestroyView();
        biz.obake.team.touchprotector.g.a.i().unregisterOnSharedPreferenceChangeListener(this);
        c.h(this);
    }

    /* access modifiers changed from: protected */
    public void onPrefChanged(SharedPreferences sharedPreferences, String str) {
    }

    /* access modifiers changed from: protected */
    public void onRamPrefChanged(String str) {
    }

    public void onRamPrefsChanged(String str) {
        onRamPrefChanged(str);
        onUpdateDisplay();
    }

    public void onResume() {
        super.onResume();
        if (this.mDeferredReloading) {
            reloadSelf();
        } else {
            onUpdateDisplay();
        }
    }

    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String str) {
        onPrefChanged(sharedPreferences, str);
        onUpdateDisplay();
    }

    /* access modifiers changed from: protected */
    public void onUpdateDisplay() {
    }

    public void onViewCreated(View view, Bundle bundle) {
        super.onViewCreated(view, bundle);
        setDividerHeight(0);
        biz.obake.team.touchprotector.g.a.i().registerOnSharedPreferenceChangeListener(this);
        c.e(this);
    }

    /* access modifiers changed from: protected */
    public void prefEnable(String str, boolean z) {
        Preference H0 = getPreferenceScreen().H0(str);
        if (H0 != null) {
            H0.l0(z);
        }
    }

    /* access modifiers changed from: protected */
    public void prefRemove(String str) {
        PreferenceScreen preferenceScreen = getPreferenceScreen();
        Preference H0 = preferenceScreen.H0(str);
        if (H0 != null) {
            preferenceScreen.O0(H0);
        }
    }

    /* access modifiers changed from: protected */
    public void prefSwitch(String str, boolean z) {
        TwoStatePreference twoStatePreference = (TwoStatePreference) getPreferenceScreen().H0(str);
        if (twoStatePreference != null) {
            twoStatePreference.G0(z);
        }
    }

    /* access modifiers changed from: protected */
    public void prefUpdateListSummary(String str) {
        ListPreference listPreference = (ListPreference) getPreferenceScreen().H0(str);
        listPreference.v0(listPreference.N0());
    }

    /* access modifiers changed from: protected */
    public void reloadSelf() {
        boolean z;
        if (isResumed()) {
            ((b) getParentFragment()).a();
            z = false;
        } else {
            z = true;
        }
        this.mDeferredReloading = z;
    }
}
